# -*- coding: utf-8 -*-
"""
@author: luhx
@file: base_util.py
@time: 2023/8/20 11:39
@desc:
"""
import re


def parse_ip_from_url(url):
    tip = re.search(r'\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b', url)
    if not tip:
        print(f"Access {url} Error!")
        return ""
    ip = tip.group()
    return ip
